﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Maps.MapControl;
using MyFloridaHouse.libSvOpenDistricts.DataService;

namespace MyFloridaHouse.libSvOpenDistricts.MapShapes
{
    public partial class MapShapeLayer
    {
        public void SubscribeToEvents()
        {
            ServiceDAL.GetLayerRegionsShapesInViewCompleted += OnServiceDALGetLayerRegionsShapesInViewCompletedEventHandler;
            ServiceDAL.GetLayerRegionsDataInViewCompleted += OnServiceDALGetLayerRegionsDataInViewCompletedEventHandler;

            RegionFill.RegionFillCriteriaChanged += onRegionFillCriteriaChanged;
            RegionLabel.RegionLabelDataChanged += onRegionLabelDataChanged;

            myBingMap.ViewChangeStart += new EventHandler<MapEventArgs>(myBingMap_ViewChangeStart);
            myBingMap.ViewChangeEnd += new EventHandler<MapEventArgs>(myBingMap_ViewChangeEnd);
        }

        public void onRegionFillCriteriaChanged(object sender, EventArgs args)
        {
            RefreshDataInView();
        }

        public void onRegionLabelDataChanged(object sender, EventArgs args)
        {
            RefreshDataInView();
        }

    }
}
